2014-09-21T00:01:20Z oldskirt joined #scheme 2014-09-21T00:05:13Z duncanm quit (Ping timeout: 260 seconds) 2014-09-21T00:06:04Z duncanm joined #scheme 2014-09-21T00:06:04Z rudybot: la la la 2014-09-21T00:06:54Z oldskirt quit (Ping timeout: 258 seconds) 2014-09-21T00:07:32Z es_ quit (Ping timeout: 260 seconds) 2014-09-21T00:08:51Z ijp: rudybot: protip: don't go on american idol 2014-09-21T00:08:52Z rudybot: ijp: an idol is a thing, right? 2014-09-21T00:11:18Z weinholt quit (Ping timeout: 246 seconds) 2014-09-21T00:13:09Z duncanm quit (Remote host closed the connection) 2014-09-21T00:13:28Z duncanm joined #scheme 2014-09-21T00:13:28Z rudybot: la la la 2014-09-21T00:18:17Z duncanm quit (Ping timeout: 272 seconds) 2014-09-21T00:18:23Z weinholt joined #scheme 2014-09-21T00:20:53Z nisstyre joined #scheme 2014-09-21T00:21:15Z nisstyre quit (Client Quit) 2014-09-21T00:24:26Z duncanm joined #scheme 2014-09-21T00:24:26Z rudybot: la la la 2014-09-21T00:29:52Z duncanm quit (Ping timeout: 245 seconds) 2014-09-21T00:30:45Z CaptainRant quit (Quit: WeeChat 0.4.3) 2014-09-21T00:31:37Z kongtomorrow quit 2014-09-21T00:40:40Z c107 joined #scheme 2014-09-21T00:40:42Z c107 quit (Changing host) 2014-09-21T00:40:43Z c107 joined #scheme 2014-09-21T00:42:01Z duncanm joined #scheme 2014-09-21T00:42:01Z rudybot: la la la 2014-09-21T00:43:14Z hiyosi joined #scheme 2014-09-21T00:43:51Z guampa quit (Remote host closed the connection) 2014-09-21T00:44:37Z guampa joined #scheme 2014-09-21T00:48:08Z hiyosi quit (Ping timeout: 260 seconds) 2014-09-21T00:50:23Z c107 quit (Remote host closed the connection) 2014-09-21T00:50:38Z c107 joined #scheme 2014-09-21T00:50:43Z c107 quit (Changing host) 2014-09-21T00:50:43Z c107 joined #scheme 2014-09-21T01:10:05Z duncanm quit (Ping timeout: 260 seconds) 2014-09-21T01:10:06Z hiyosi joined #scheme 2014-09-21T01:11:33Z eupcan277 quit (Ping timeout: 260 seconds) 2014-09-21T01:13:30Z eupcan277 joined #scheme 2014-09-21T01:16:56Z Gyps joined #scheme 2014-09-21T01:17:03Z duncanm joined #scheme 2014-09-21T01:17:06Z rudybot: la la la 2014-09-21T01:17:48Z oleo quit (Read error: Connection reset by peer) 2014-09-21T01:18:05Z bobbinnumerous quit (Ping timeout: 260 seconds) 2014-09-21T01:19:50Z oleo joined #scheme 2014-09-21T01:24:27Z duncanm quit (Ping timeout: 246 seconds) 2014-09-21T01:26:46Z duncanm joined #scheme 2014-09-21T01:26:46Z rudybot: la la la 2014-09-21T01:36:21Z jcloud joined #scheme 2014-09-21T01:36:37Z duncanm quit (Ping timeout: 272 seconds) 2014-09-21T01:36:56Z duncanm joined #scheme 2014-09-21T01:36:56Z rudybot: la la la 2014-09-21T01:38:23Z nisstyre joined #scheme 2014-09-21T01:49:08Z omefire joined #scheme 2014-09-21T01:53:57Z tobik quit (Ping timeout: 272 seconds) 2014-09-21T01:54:50Z tobik joined #scheme 2014-09-21T02:10:11Z kongtomorrow joined #scheme 2014-09-21T02:17:32Z Rodya_ quit (Quit: Ex-Chat) 2014-09-21T02:19:23Z kongtomorrow quit 2014-09-21T02:22:19Z kongtomorrow joined #scheme 2014-09-21T02:28:28Z ehaliewi` joined #scheme 2014-09-21T02:29:39Z LeoNerd quit (Remote host closed the connection) 2014-09-21T02:29:51Z LeoNerd joined #scheme 2014-09-21T02:31:17Z ehaliewicz quit (Ping timeout: 272 seconds) 2014-09-21T02:31:21Z duncanm quit (Ping timeout: 260 seconds) 2014-09-21T02:35:39Z guampa quit (Ping timeout: 264 seconds) 2014-09-21T02:36:57Z mrowe_away quit (Ping timeout: 260 seconds) 2014-09-21T02:37:25Z akkad quit (Ping timeout: 260 seconds) 2014-09-21T02:37:28Z MouldyOldBones quit (Ping timeout: 264 seconds) 2014-09-21T02:37:52Z araujo joined #scheme 2014-09-21T02:38:56Z mrowe_away joined #scheme 2014-09-21T02:40:00Z b4283 joined #scheme 2014-09-21T02:41:31Z akkad joined #scheme 2014-09-21T02:42:51Z guampa joined #scheme 2014-09-21T02:43:44Z klltkr quit (Quit: My MacBook has gone to sleep. ZZZzzz…) 2014-09-21T02:43:52Z ehaliewi` is now known as ehaliewicz 2014-09-21T02:45:51Z jlongster quit (Ping timeout: 272 seconds) 2014-09-21T02:49:29Z fgudin quit (Remote host closed the connection) 2014-09-21T02:50:09Z kongtomorrow quit 2014-09-21T03:00:51Z guampa quit (Ping timeout: 264 seconds) 2014-09-21T03:09:57Z c74d quit (Ping timeout: 272 seconds) 2014-09-21T03:13:32Z rudybot_ joined #scheme 2014-09-21T03:13:46Z rudybot_ quit (Remote host closed the connection) 2014-09-21T03:14:06Z pera quit (Quit: leaving) 2014-09-21T03:17:12Z eupcan277_d joined #scheme 2014-09-21T03:17:21Z guampa joined #scheme 2014-09-21T03:17:33Z eupcan277 quit (Ping timeout: 272 seconds) 2014-09-21T03:20:44Z dagnir joined #scheme 2014-09-21T03:27:06Z c74d joined #scheme 2014-09-21T03:30:21Z jlongster joined #scheme 2014-09-21T03:34:27Z jlongster quit (Ping timeout: 245 seconds) 2014-09-21T03:36:54Z c74d quit (Remote host closed the connection) 2014-09-21T03:40:29Z c74d joined #scheme 2014-09-21T03:46:12Z ehaliewicz quit (Ping timeout: 246 seconds) 2014-09-21T03:57:34Z dagnir quit (Quit: WeeChat 0.4.2) 2014-09-21T03:59:51Z jlongster joined #scheme 2014-09-21T04:02:16Z eupcan277_d quit (Ping timeout: 258 seconds) 2014-09-21T04:03:56Z eupcan277 joined #scheme 2014-09-21T04:04:02Z jlongster quit (Ping timeout: 245 seconds) 2014-09-21T04:04:38Z common-lisper joined #scheme 2014-09-21T04:05:05Z davexunit quit (Remote host closed the connection) 2014-09-21T04:21:32Z emma quit (Ping timeout: 245 seconds) 2014-09-21T04:28:07Z kongtomorrow joined #scheme 2014-09-21T04:37:15Z emma joined #scheme 2014-09-21T04:41:37Z kongtomorrow quit 2014-09-21T04:42:24Z eupcan277 quit (Ping timeout: 272 seconds) 2014-09-21T04:42:47Z eupcan277_y joined #scheme 2014-09-21T04:53:48Z emma quit (Ping timeout: 272 seconds) 2014-09-21T04:59:49Z jlongster joined #scheme 2014-09-21T05:04:20Z jlongster quit (Ping timeout: 260 seconds) 2014-09-21T05:06:25Z common-lisper quit (Remote host closed the connection) 2014-09-21T05:12:27Z kobain quit (Quit: KVIrc 4.1.3 Equilibrium http://www.kvirc.net/) 2014-09-21T05:14:43Z eupcan277_y quit (Ping timeout: 272 seconds) 2014-09-21T05:14:52Z c107 quit (Ping timeout: 240 seconds) 2014-09-21T05:16:57Z atomx quit (Ping timeout: 260 seconds) 2014-09-21T05:18:32Z offby1: rudybot: seen duncanm 2014-09-21T05:18:32Z rudybot: *offby1: duncanm was seen joining in #scheme three hours ago, and then duncanm was seen quitting two hours ago, saying "Ping timeout: 260 seconds" 2014-09-21T05:20:31Z eupcan277_y joined #scheme 2014-09-21T05:28:30Z common-lisper joined #scheme 2014-09-21T05:44:09Z common-lisper quit (Remote host closed the connection) 2014-09-21T06:21:58Z alexei___ joined #scheme 2014-09-21T06:29:57Z leo2007 joined #scheme 2014-09-21T06:30:15Z ilammy joined #scheme 2014-09-21T06:40:48Z MouldyOldBones joined #scheme 2014-09-21T07:01:33Z daviid quit (Ping timeout: 260 seconds) 2014-09-21T07:16:05Z alexei___ quit (Ping timeout: 272 seconds) 2014-09-21T07:21:20Z Gyps quit (Quit: Gyps) 2014-09-21T07:32:55Z alexei___ joined #scheme 2014-09-21T07:51:48Z kongtomorrow joined #scheme 2014-09-21T07:58:46Z vinleod joined #scheme 2014-09-21T08:02:45Z alexei___ quit (Ping timeout: 246 seconds) 2014-09-21T08:11:01Z kongtomorrow quit 2014-09-21T08:20:43Z DGASAU quit (Remote host closed the connection) 2014-09-21T08:22:03Z DGASAU joined #scheme 2014-09-21T08:26:34Z oldskirt joined #scheme 2014-09-21T08:30:26Z deathrabbit joined #scheme 2014-09-21T08:33:21Z yacks quit (Ping timeout: 272 seconds) 2014-09-21T08:36:02Z alexei___ joined #scheme 2014-09-21T08:43:12Z yacks joined #scheme 2014-09-21T08:44:03Z deathrabbit: scheme!!! 2014-09-21T08:44:03Z deathrabbit: im loving it! 2014-09-21T08:45:06Z deathrabbit: so painless compared to perl python ruby php 2014-09-21T08:45:06Z deathrabbit: why isnt everyone using scheme? 2014-09-21T08:53:43Z deathrabbit quit (Quit: Leaving.) 2014-09-21T08:53:46Z ilammy: (not (everyone (lambda (x) (likes x (because-of superstitions))) parentheses)) 2014-09-21T08:54:11Z ilammy: i'm too slow :( 2014-09-21T09:07:09Z wingo joined #scheme 2014-09-21T09:11:37Z kongtomorrow joined #scheme 2014-09-21T09:26:23Z robot-beethoven quit (Quit: ERC Version 5.3 (IRC client for Emacs)) 2014-09-21T09:37:13Z stepnem joined #scheme 2014-09-21T09:39:08Z ijp: ilammy: well, since I'm pretty sure that was gavino, that's a good thing 2014-09-21T09:39:13Z ijp: they'd only waste your time 2014-09-21T09:41:32Z alexei___ quit (Ping timeout: 245 seconds) 2014-09-21T09:43:15Z kongtomorrow quit 2014-09-21T09:43:32Z eupcan277_y quit (Read error: Connection reset by peer) 2014-09-21T09:45:22Z mrowe_away is now known as mrowe 2014-09-21T10:19:43Z dmiles_afk quit (Read error: Connection reset by peer) 2014-09-21T10:20:13Z dmiles_afk joined #scheme 2014-09-21T10:31:01Z kongtomorrow joined #scheme 2014-09-21T10:35:34Z kongtomorrow quit (Ping timeout: 258 seconds) 2014-09-21T10:38:21Z yacks quit (Quit: Leaving) 2014-09-21T10:38:36Z yacks joined #scheme 2014-09-21T10:43:14Z BitPuffin quit (Ping timeout: 258 seconds) 2014-09-21T10:44:22Z Nizumzen joined #scheme 2014-09-21T10:53:52Z sbwhitecap joined #scheme 2014-09-21T11:04:36Z mrowe is now known as mrowe_away 2014-09-21T11:11:16Z alexei___ joined #scheme 2014-09-21T11:19:18Z Nizumzen quit (Ping timeout: 272 seconds) 2014-09-21T11:36:44Z lrs_ joined #scheme 2014-09-21T11:37:23Z lrs_: http://pastebin.com/a6CLwnf2 < How do I write a function that does multiplication from this 2014-09-21T11:37:33Z lrs_: I need to change the (succ(plus (pred a) b) in some way 2014-09-21T11:40:56Z ijp: lrs_: well, what is multiplication? 2014-09-21T11:41:05Z ijp: (yes, I know the answer) 2014-09-21T11:42:51Z lrs_: Repeated addition 2014-09-21T11:43:16Z ijp: okay, and how do you repeat something n times in scheme? 2014-09-21T11:43:31Z lrs_: Recursive function (?) 2014-09-21T11:43:36Z ijp: right 2014-09-21T11:44:06Z ijp: so, where is your confusion? 2014-09-21T11:44:43Z lrs_: Well. How do I implement it? 2014-09-21T11:45:05Z ijp: do you understand that definition of plus? 2014-09-21T11:46:26Z lrs_: Not sure 2014-09-21T11:46:50Z mutley89 joined #scheme 2014-09-21T11:47:44Z davexunit joined #scheme 2014-09-21T11:48:00Z ijp: which parts are you struggling with? 2014-09-21T11:48:21Z lrs_: (succ (plus (pred a) b))))) 2014-09-21T11:51:41Z ijp: lrs_: well, you are familiar with the rule that (1 + a) + b = 1 + (a + b) 2014-09-21T11:52:42Z lrs_: Yes ijp 2014-09-21T11:52:48Z ijp: replacing a with (a - 1), that becomes a + b = 1 + ((a - 1) + b), which is what the code says 2014-09-21T11:53:52Z ijp: since you have tested the natural number, and found it to be nonzero, you know you can find its predecessor, and by recursion the value of ((a - 1) + b) 2014-09-21T11:56:07Z lrs_: (succ (plus (pred a) b))))) = 1+(a+b) 2014-09-21T11:56:08Z lrs_: ? 2014-09-21T11:56:24Z ijp: no, 1 + ((a - 1) + b) 2014-09-21T11:56:59Z lrs_: succ= 1 ? 2014-09-21T11:57:09Z ijp: succ x = 1 + x 2014-09-21T11:57:35Z lrs_: And plus is? 2014-09-21T11:57:40Z ijp: + 2014-09-21T11:58:00Z lrs_: How is plus + when it isnt defined as plus yet? 2014-09-21T11:58:14Z lrs_: Does pred a create the plus? 2014-09-21T11:58:35Z pyro-_ left #scheme 2014-09-21T11:59:51Z ijp: excuse me? 2014-09-21T12:00:13Z lrs_: Succ x = 1 + x 2014-09-21T12:00:29Z lrs_: 1+(plus(pred a) b)) 2014-09-21T12:00:29Z lrs_: ? 2014-09-21T12:00:58Z ijp: perhaps I shouldn't have tried using normal notation, it only seems to be confusing you 2014-09-21T12:06:45Z ijp: lrs_: anyway, I have to go but when looking over the definition of plus, what it is essentially saying is 0 + b = b, and a + b = 1 + ((a - 1) + b) 2014-09-21T12:07:26Z BitPuffin joined #scheme 2014-09-21T12:09:24Z ijp quit (Quit: goto library;) 2014-09-21T12:18:20Z Nizumzen joined #scheme 2014-09-21T12:21:59Z Steverman joined #scheme 2014-09-21T12:25:48Z oldskirt quit (Ping timeout: 260 seconds) 2014-09-21T12:29:12Z oldskirt joined #scheme 2014-09-21T12:42:59Z lrs_: Fuck 2014-09-21T12:43:02Z lrs_: I dont get it 2014-09-21T12:43:28Z lrs_: How the hell do I write a multiplication thing with this cryptic way of writing shit 2014-09-21T13:01:05Z vinleod quit (Quit: ["Textual IRC Client: www.textualapp.com"]) 2014-09-21T13:01:38Z hiroakip joined #scheme 2014-09-21T13:18:14Z pera joined #scheme 2014-09-21T13:22:32Z emma joined #scheme 2014-09-21T13:23:44Z MouldyOldBones quit (Remote host closed the connection) 2014-09-21T13:25:15Z MouldyOldBones joined #scheme 2014-09-21T13:30:40Z lrs_: Noone? 2014-09-21T13:34:02Z oldskirt quit (Ping timeout: 245 seconds) 2014-09-21T13:34:06Z ilammy: uh? 2014-09-21T13:34:54Z ilammy: and what cryptic things does '0 * b = 0', 'a * b = b + (a - 1) * b' contain? 2014-09-21T13:40:37Z lrs_: ilammy, 2014-09-21T13:40:44Z lrs_: (succ (plus (pred a) b))))) = 1 + ((a - 1) + b) 2014-09-21T13:40:55Z lrs_: How do I create a multiplication procedure of that exactly? 2014-09-21T13:41:12Z taylanub quit (Disconnected by services) 2014-09-21T13:41:47Z lrs_: And if (plus (a-1)+b) means plus 2014-09-21T13:41:51Z taylanub joined #scheme 2014-09-21T13:41:54Z lrs_: Then why is there a plus after 1 2014-09-21T13:42:00Z oldskirt joined #scheme 2014-09-21T13:42:11Z lrs_: And plus isnt even defined as a operator that does 2014-09-21T13:42:47Z lrs_: Or is everything that is (a (ab) b) defined as = + a +(a + b) +b 2014-09-21T13:42:53Z lrs_: I dont get it :| 2014-09-21T13:42:58Z ilammy: (plus b (mul (pred a) b)) = b + ((a - 1) * b) 2014-09-21T13:43:01Z ilammy: maic! 2014-09-21T13:44:11Z lrs_: mul undefined 2014-09-21T13:44:22Z lrs_: And I need to define multiplication by using pred and succ 2014-09-21T13:44:25Z lrs_: Which is defined in 2014-09-21T13:44:37Z lrs_: http://pastebin.com/a6CLwnf2 2014-09-21T13:45:15Z ilammy: well, in 'a + b = 1 + ((a - 1) + b)' there are two pluses: the one being (recursively) defined, and the one that's a part of succ 2014-09-21T13:47:32Z ilammy: you did define plus recursively, now mul can be defined in terms of itself, pred, and plus (which was defined in terms of pred and succ) 2014-09-21T13:47:49Z lrs_: so mul is (pred a) or what 2014-09-21T13:49:17Z ilammy: 2014-09-21T13:50:08Z ilammy: you had plus defined as (plus 0 a) ==> a, (plus a b) ==> (succ (plus (pred a) b)) 2014-09-21T13:50:37Z ilammy: now you define mul as (mul 0 a) ==> 0, (mul a b) ==> (plus b (mul (pred a) b)) 2014-09-21T13:50:40Z lrs_: 2014-09-21T13:52:15Z lrs_: (plus 0 a) ==> a ? 2014-09-21T13:52:28Z lrs_: What do you mean when you say that 2014-09-21T13:53:53Z ilammy: when you call (plus 0 a) you get 'a' as a result, that 'if' thingy decides which branch to take 2014-09-21T13:54:28Z lrs_: Right 2014-09-21T13:55:27Z lrs_: ilammy, Do I create a separate definition for that 2014-09-21T13:56:13Z ilammy: What for? mul? Definitely, you will need to define it separately 2014-09-21T14:02:31Z lrs_: ilammy, Why (mul a b) ==> (plus b (mul (pred a) b)) 2014-09-21T14:02:52Z lrs_: Im not gonna use plus after this right 2014-09-21T14:02:55Z lrs_: If I write this: 2014-09-21T14:03:00Z zlrth quit (Remote host closed the connection) 2014-09-21T14:03:16Z lrs_: ilammy, http://pastebin.com/WsR3zwTz 2014-09-21T14:04:16Z hiroakip quit (Ping timeout: 260 seconds) 2014-09-21T14:07:55Z oleo is now known as Guest75356 2014-09-21T14:09:34Z oleo__ joined #scheme 2014-09-21T14:11:21Z Guest75356 quit (Ping timeout: 260 seconds) 2014-09-21T14:14:58Z Riastradh joined #scheme 2014-09-21T14:16:25Z Steverman quit (Ping timeout: 260 seconds) 2014-09-21T14:20:20Z lrs_: ilammy, Doesnt work 2014-09-21T14:32:17Z lrs_: Fuuuck 2014-09-21T14:33:33Z lrs_: The Structure and Interpretation of Computer Programs doesnt say anything about how to solve this 2014-09-21T14:33:35Z lrs_: :( 2014-09-21T14:33:55Z ilammy: > (if (= a 0) b ...) 2014-09-21T14:34:03Z ilammy: why is this 'b'? 2014-09-21T14:34:15Z ilammy: it should be 0, because (mul a b) = 0 if a = 0 2014-09-21T14:36:47Z lrs_: Shouldnt it be 2014-09-21T14:36:55Z lrs_: (if (=0 b) 2014-09-21T14:37:01Z lrs_: Or is it (if (= 0 a)0) 2014-09-21T14:42:44Z ilammy: that thing that is decremented with pred should be compared to zero 2014-09-21T14:43:17Z yacks quit (Quit: Leaving) 2014-09-21T14:43:20Z ilammy: else it would be an infinite loop, because non-zero number will never be equal to zero 2014-09-21T14:50:00Z kobain joined #scheme 2014-09-21T14:52:31Z lrs_: ilammy, Whats "decremented", my native tongue isnt english 2014-09-21T14:54:48Z Nizumzen quit (Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/) 2014-09-21T14:55:38Z ilammy: that's what 'pred' does, substracts one from a number 2014-09-21T14:56:24Z lrs_: ilammy, http://pastebin.com/yUzzU290 this is how it looks right now 2014-09-21T14:57:52Z oleo__ quit (Quit: Verlassend) 2014-09-21T14:58:23Z ARM9 joined #scheme 2014-09-21T14:58:25Z ilammy: your parentheses are unbalanced ;) 2014-09-21T14:58:58Z ilammy: oh, no, they're balanced 2014-09-21T14:59:24Z hiyosi quit (Quit: WeeChat 1.0) 2014-09-21T14:59:35Z ilammy: but you're doing the if wrong, it should be (if ) 2014-09-21T14:59:45Z hiyosi joined #scheme 2014-09-21T14:59:48Z oleo__ joined #scheme 2014-09-21T14:59:57Z oleo__ quit (Read error: Connection reset by peer) 2014-09-21T15:00:45Z atomx joined #scheme 2014-09-21T15:00:50Z oleo joined #scheme 2014-09-21T15:05:17Z BitPuffin quit (Ping timeout: 245 seconds) 2014-09-21T15:08:29Z lrs_: ilammy, Hmm? 2014-09-21T15:09:23Z lrs_: ilammy, (if (= 0 a) 0) < Thats what I did.. or? 2014-09-21T15:09:36Z lrs_: The 0 shouldnt be inside the paranthesis what I know atleast 2014-09-21T15:09:51Z lrs_: I am also curious why you have the b there... Some counting stuff? 2014-09-21T15:11:09Z ilammy: Effectively you've written this (watch the indentation): (define mul (lambda (a b) (if (= 0 a) 0) b (plus b (mul (pred a) b)) ) ) 2014-09-21T15:11:24Z ilammy: bwa... 2014-09-21T15:11:26Z ilammy: okay... 2014-09-21T15:12:01Z ilammy: https://gist.github.com/ilammy/b7871676c771549f6d56 2014-09-21T15:12:24Z ilammy: the way that lambda works is evaluate things in order they are written 2014-09-21T15:12:54Z ilammy: so it first evaluates the (if ...), then 0, then that function call, and returns the value of the last evaluated expression 2014-09-21T15:13:16Z ilammy: s/then 0/then b/ 2014-09-21T15:13:45Z lrs_: HMm 2014-09-21T15:14:05Z lrs_: Right 2014-09-21T15:14:12Z lrs_: Tail call shit 2014-09-21T15:14:16Z ilammy: while you should return the value of (if ...), and that value should be either 0, or that b + (a - 1) * b 2014-09-21T15:14:40Z lrs_: Hmm 2014-09-21T15:15:03Z lrs_: How do i return the value of if? its right or false right 2014-09-21T15:15:15Z lrs_: The way I get what I wrote its like this 2014-09-21T15:15:36Z lrs_: lambda a b, says that there are two variables a and b that I can use locally in the define box 2014-09-21T15:16:02Z lrs_: if says that if a is 0 it does (0) (??) 2014-09-21T15:16:06Z lrs_: If not it does b 2014-09-21T15:16:18Z lrs_: Which is (plus b (mul(pred a) b )))) 2014-09-21T15:16:21Z ilammy: no 2014-09-21T15:16:22Z lrs_: And Im pretty sure I am wrong 2014-09-21T15:16:27Z ilammy: there are two forms of if 2014-09-21T15:16:53Z ilammy: (if condition then-something) - this returns 'then-something' if 'condition' is non-#f 2014-09-21T15:17:13Z lrs_: Right 2014-09-21T15:17:24Z lrs_: condition = (= 0 a) then 0 2014-09-21T15:17:27Z ilammy: and (if condition then-something else-another-thing) - this returns 'then' thing if 'condition' is non-#f and the 'else' thing if it is #f 2014-09-21T15:17:37Z oleo quit (Read error: Connection reset by peer) 2014-09-21T15:18:11Z lrs_: If it is #t 2014-09-21T15:18:15Z lrs_: It does b? 2014-09-21T15:19:20Z ilammy: And #t, yeah. But for historical reasons anything that is not #f is considered 'true', including the explicit 'true' value #t 2014-09-21T15:19:40Z lrs_: Right 2014-09-21T15:19:46Z lrs_: But what does the b mean 2014-09-21T15:20:23Z ilammy: no, (if (= 0 a) 0) equals 0 if a = 0, and is an undefined value otherwise 2014-09-21T15:20:51Z lrs_: What does it evaluate if a is not 0 2014-09-21T15:21:04Z ilammy: it does not mean anything, the whole thing should be just (if (= 0 a) 0 (plus b ...)) 2014-09-21T15:21:06Z lrs_: It does (plus b (Mul/pred a) b))) i presume 2014-09-21T15:21:35Z lrs_: (mul 0 3) evaluates 0 2014-09-21T15:21:54Z lrs_: (mul 1 3) evaules b (plus b(mul(pred a) b))) 2014-09-21T15:22:18Z ilammy: that 'returns' thing I said should not be read as 'returns as a result of call to mul' 2014-09-21T15:22:45Z lrs_: What does that mean 2014-09-21T15:23:33Z ilammy: A function defined by lambda form returns the value of the last expression in calculates 2014-09-21T15:23:35Z oleo joined #scheme 2014-09-21T15:23:59Z ilammy: if you define some (lambda (x) 1 2 3) and then call it, it will return 3 2014-09-21T15:24:04Z lrs_: The last expression in the function? 2014-09-21T15:24:24Z lrs_: So it would be 3 instead of b then? 2014-09-21T15:24:33Z lrs_: So lambda is like a order of actions or something 2014-09-21T15:24:59Z ilammy: Yeah, right. 2014-09-21T15:25:10Z ilammy: And the if form does not influence this order. 2014-09-21T15:25:41Z lrs_: Coudl i put the plus before if? 2014-09-21T15:25:55Z ilammy: if you calculate '(if condition 9) 1 2 3' it will be always 3, regardless of the conditions' value 2014-09-21T15:26:29Z ijp joined #scheme 2014-09-21T15:26:50Z ilammy: technically yes, you can do that 2014-09-21T15:27:02Z ilammy: but you do not need to add anything if one of the arguments is zero 2014-09-21T15:27:07Z lrs_: I meant the (plus b (mul .. 2014-09-21T15:27:22Z yacks joined #scheme 2014-09-21T15:27:37Z ilammy: oh... no, _that_ thing should be _inside_ the if form 2014-09-21T15:27:42Z lrs_: ilammy, But I dont get how anything is wrong in the text you wrote though 2014-09-21T15:27:47Z lrs_: The if is correct 2014-09-21T15:27:52Z lrs_: Oh ok 2014-09-21T15:28:19Z lrs_: Does the b call the (plus b(mul .. stuff? 2014-09-21T15:28:26Z ilammy: no, it's not 2014-09-21T15:28:53Z ilammy: it should have a value of that (plus ...) when a is not 0, but it has undefined value now 2014-09-21T15:30:13Z lrs_: Ok, not really sure what you mean by that but ok 2014-09-21T15:31:42Z ilammy: just run the interpreter and compare the behavior of (define (foo a) (if (= a 0) 1 2)) and (define (bar a) (if (= a 0) 1) 2) 2014-09-21T15:32:47Z klltkr joined #scheme 2014-09-21T15:33:19Z lrs_: OK, I get it 2014-09-21T15:33:41Z lrs_: Can we go back to the problem? It still doesnt work 2014-09-21T15:34:16Z lrs_: I also dont really get why it has b as nam,e 2014-09-21T15:34:21Z lrs_: The b, I dont really get at all 2014-09-21T15:39:06Z ilammy: https://gist.github.com/ilammy/b7871676c771549f6d56 - an updated version (I gave up on my outstanding mentorship skills and just handed out a solution) 2014-09-21T15:39:21Z ilammy: what about b there? 2014-09-21T15:41:12Z lrs_: ilammy, replaced by 0 2014-09-21T15:42:40Z lrs_: ilammy, Fuck. I thought the b was something that called the (plus b) since it was on a new line of text 2014-09-21T15:42:50Z lrs_: But its connected with the if 2014-09-21T15:42:56Z lrs_: So yeah, I get that conditional thing 2014-09-21T15:43:06Z lrs_: Im just curious on how the function calls (plus b ... 2014-09-21T15:43:24Z lrs_: Does it just go from top to bottom or does lambda say something about compiling stuff? 2014-09-21T15:43:36Z lrs_: Also I dont really get how it works... 2014-09-21T15:44:47Z lrs_: If (succ (plus (pred a) b))))) is 1 + ((a - 1) + b) 2014-09-21T15:45:36Z lrs_: THe mul should be uuh 2014-09-21T15:46:09Z oldskirt quit (Ping timeout: 272 seconds) 2014-09-21T15:46:41Z lrs_: ilammy, FUCK 2014-09-21T15:46:45Z lrs_: I still dont get it 2014-09-21T15:47:03Z sbwhitecap quit (Quit: Leaving...) 2014-09-21T15:47:16Z lrs_: I get the if thing, that was just me being stupid and not realizing it was just a line break, but I have a real hard time understand how the recursive tree thing works 2014-09-21T15:48:19Z ilammy: The body of mul is just (if ...) form. So when (mul 2 3) is called, this (if ...) thing is going to be evaluated and its value will be the value of (mul 2 3) 2014-09-21T15:48:34Z ilammy: The line breaks do not matter. The parentheses do. 2014-09-21T15:49:18Z ilammy: And the (if condition then else) form first evaluates the condition, and then the 'then' thing or 'else' thing, based of the value of condition. 2014-09-21T15:49:31Z lrs_: Yep I get that 2014-09-21T15:49:57Z lrs_: I just wondering if you could concentrate your outstanding mentorship skills on how they connect and how their recursive tree looks like 2014-09-21T15:50:05Z lrs_: The plus b (mul (pred a) b) 2014-09-21T15:50:27Z lrs_: How does it look mathematicall 2014-09-21T15:50:29Z lrs_: y 2014-09-21T15:50:49Z lrs_: And how does mul call the plus function 2014-09-21T15:50:58Z ARM9: b + ((pred a) * b) 2014-09-21T15:51:01Z ARM9: whatever pred a means 2014-09-21T15:51:03Z ilammy: (btw, that was an irony, about mentorship skills) 2014-09-21T15:51:25Z lrs_: I think your mentorship skills are good 2014-09-21T15:51:34Z ilammy: (plus b (mul (pred a) b)) = b + (a - 1) * b 2014-09-21T15:52:05Z lrs_: Ah 2014-09-21T15:52:21Z ilammy: it's called prefix notation, or polish notation (forgot whether it's a normal or reversed one) 2014-09-21T15:52:22Z lrs_: And if you go more complex than that? 2014-09-21T15:52:35Z ilammy: Then you suffer 2014-09-21T15:52:44Z lrs_: Can you do it? 2014-09-21T15:53:02Z lrs_: I mean I have to understand it if I need to understand the function right? 2014-09-21T15:53:02Z ilammy: Or declare more functions to keep things readable 2014-09-21T15:53:31Z ilammy: What 'it' you should understand? I just lost the track... 2014-09-21T15:53:41Z lrs_: (plus b (mul (pred a) b)) = b + (a - 1) * b 2014-09-21T15:53:51Z lrs_: What plus, mul and pred means 2014-09-21T15:53:57Z lrs_: My guess is that uh 2014-09-21T15:54:01Z ilammy: About more complex mathematical expressions/ 2014-09-21T15:54:15Z ilammy: They are functions. 2014-09-21T15:54:23Z lrs_: No, I mean what those plus, mul and pred looks like if you would "expand" the expression 2014-09-21T15:54:31Z lrs_: Or is it impossible to do? 2014-09-21T15:55:58Z ilammy: What do you mean by "expand"? Substitute those (lambda (...) ...) things instead of names? 2014-09-21T15:56:03Z pnpuff joined #scheme 2014-09-21T15:58:51Z lrs_: i mean the mul plus.. 2014-09-21T15:59:48Z jlongster joined #scheme 2014-09-21T16:00:29Z autochthon joined #scheme 2014-09-21T16:01:01Z ilammy: Sorry, I don't get you. Do you mean the way how we get from (mul 2 3) to 6? 2014-09-21T16:04:02Z jlongster quit (Ping timeout: 245 seconds) 2014-09-21T16:04:19Z bit` joined #scheme 2014-09-21T16:04:31Z ilammy is away for half an hour or so 2014-09-21T16:16:59Z daviid joined #scheme 2014-09-21T16:17:55Z pjdelport: lrs_: The short version is that plus and mul are usually implemented as primitives. 2014-09-21T16:18:25Z pjdelport: Which means that they usually don't expand to other Scheme code like a define does, but to lower-level code. 2014-09-21T16:19:48Z pjdelport: They could compile to C or machine code; or they could simply be implement in terms of some other host language's arithmetic primitives for Scheme implementations written in high-level languages. 2014-09-21T16:22:41Z yacks quit (Quit: Leaving) 2014-09-21T16:22:46Z suppi joined #scheme 2014-09-21T16:22:46Z suppi quit (Changing host) 2014-09-21T16:22:46Z suppi joined #scheme 2014-09-21T16:23:11Z lrs_: pjdelport, Right, I get that 2014-09-21T16:23:14Z lrs_: WHat I dont get is 2014-09-21T16:23:21Z klltkr quit (Quit: My MacBook has gone to sleep. ZZZzzz…) 2014-09-21T16:23:24Z lrs_: That 2014-09-21T16:23:38Z lrs_: (plus b (mul (pred a) b)) = b + (a - 1) * b 2014-09-21T16:23:41Z lrs_: And 2014-09-21T16:24:15Z lrs_: Or rather 2014-09-21T16:24:16Z lrs_: (plus b (mul (pred a) b)) = b + (a - 1) * b 2014-09-21T16:24:16Z lrs_: (succ (plus (pred a) b))))) = 1 + ((a - 1) + b) 2014-09-21T16:24:28Z pjdelport: Hmm, what about it is unclear? 2014-09-21T16:24:35Z pjdelport: The pred and succ stuff? 2014-09-21T16:24:35Z lrs_: And how a combination of them become multiplication :| 2014-09-21T16:24:39Z pjdelport: Or the translation to infix? 2014-09-21T16:24:47Z lrs_: pred is from what i get (x +1) 2014-09-21T16:25:42Z lrs_: And I dont really understand what the paranthesis does.. Is it multiplication or just a recursive tree? 2014-09-21T16:25:51Z pjdelport scrollbacks 2014-09-21T16:26:03Z pjdelport: Oh, in Scheme, the parentheses mean function application. 2014-09-21T16:26:50Z pjdelport: They're not optional: in other words, just about informal grouping or precedence or such like in other languages, or in mathematical notation. 2014-09-21T16:27:04Z pjdelport: You can think of Scheme's parens as being the function application operator. 2014-09-21T16:27:20Z lrs_: So (plus b(mul (pred a) b)) = (f(b) ( g(h(a)) (a))) 2014-09-21T16:27:25Z lrs_: Or something? 2014-09-21T16:28:22Z lrs_: plus b= f(b), mul b = g(b) pred=(h(a)) 2014-09-21T16:28:23Z lrs_: Or something 2014-09-21T16:28:26Z lrs_: Gah. 2014-09-21T16:31:55Z pjdelport: Right: (f a b c) applies the function f to the three argumenst a, b, and c. 2014-09-21T16:32:56Z BitPuffin joined #scheme 2014-09-21T16:33:51Z pjdelport: If you had a nullary function g, you would actually say: (f a (g) c) 2014-09-21T16:33:55Z lrs_: pjdelport, so (plus b(mul (pred a) b)) means, apply the function plus (b???) on the function mul which applies itslef on pred a 2014-09-21T16:34:12Z pjdelport: That calls 'g' as a function, and then uses the result as the parameter to pass to f. 2014-09-21T16:34:27Z lrs_: Is nullary = null? 2014-09-21T16:34:41Z pjdelport: Oh, no, sorry; that just means it takes no argument. 2014-09-21T16:35:09Z pjdelport: So nullary = zero paramaters, unary = 1 parameter, binary = 2 parameters, and so on. 2014-09-21T16:35:16Z pjdelport: Just a shorthand. 2014-09-21T16:35:56Z pjdelport: (So in the above examples, pred is a unary operator/function, and plus and mul are binary operators/functions.) 2014-09-21T16:36:19Z pjdelport: lrs_: You can think of reading (plus b (mul (pred a) b)) from the inside out 2014-09-21T16:36:34Z pjdelport: First (pred a) will be called to get the predecessor of 'a'. 2014-09-21T16:37:09Z pjdelport: The result value will be passed as the first argument of mul: (mul <...> b) 2014-09-21T16:37:12Z lrs_: a which is the input a in (plus a b) (?) 2014-09-21T16:37:18Z pjdelport: where <...> stands for the result of (pred a). 2014-09-21T16:37:37Z pjdelport: And the result of that will be used to call the outer plus with, and so on. 2014-09-21T16:37:49Z pjdelport: a is just a variable: it would have to be defined earler. 2014-09-21T16:37:51Z pjdelport: eralier, even 2014-09-21T16:37:56Z pjdelport: earlier xP 2014-09-21T16:40:39Z pjdelport: Does that make it a bit clearer how the Scheme syntax (plus b (mul (pred a) b)) translates to the conventional syntax "b + (a - 1) * b"? 2014-09-21T16:41:50Z pjdelport: So in other words: 2014-09-21T16:41:50Z pjdelport: (pred a) → a - 1 2014-09-21T16:41:50Z pjdelport: (mul ... b) → (...) * b 2014-09-21T16:41:50Z pjdelport: (plus b ...) → b + (...) 2014-09-21T16:44:09Z pjdelport: Does that make sense? 2014-09-21T16:44:59Z lrs_: Well, I kind of get why it becomes b + (a-1) b 2014-09-21T16:45:21Z lrs_: But I didnt know that it compiles inside and out, but it makes sense because of its recursiveness 2014-09-21T16:45:30Z lrs_: Its the operators im kind of curious of though 2014-09-21T16:45:37Z lrs_: How the hell it compiles that 2014-09-21T16:45:51Z lrs_: Since I am assuming it is like 2014-09-21T16:45:58Z lrs_: Or hmm, I dont really get that at all 2014-09-21T16:46:03Z lrs_: I understand what you wrote 2014-09-21T16:46:34Z lrs_: "b + (a - 1) * b, but how does it call those earlier functions defined and how does that look like? 2014-09-21T16:47:08Z lrs_: If its 2014-09-21T16:47:10Z lrs_: a+b 2014-09-21T16:47:14Z lrs_: And I defined plus 2014-09-21T16:47:21Z lrs_: a (succ (plus (pred a) b))))) b 2014-09-21T16:47:24Z lrs_: :| 2014-09-21T16:47:56Z lrs_: All this stuff is very new to me and since I come from a mathematical view I need to think of this from a computer science-view or whatever 2014-09-21T16:48:43Z ilammy: No, those 'a + b' are just for humans. 2014-09-21T16:49:11Z ilammy: In Scheme you _must_ write it in the prefix form, like (+ a b). 2014-09-21T16:49:28Z lrs_: That I know 2014-09-21T16:49:44Z ilammy: (There are so-called sweet expressions, though, which allow to write {a + b} or something like that.) 2014-09-21T16:49:47Z lrs_: The whole thing about this problem was to replace the (+ a b) and use pred and succ instead 2014-09-21T16:50:40Z suppi_ joined #scheme 2014-09-21T16:51:31Z ilammy: If you want to know how (plus a b) will be evaluated then consider the substitution model of evaluation. It should be described in SICP. 2014-09-21T16:52:23Z suppi quit (Ping timeout: 258 seconds) 2014-09-21T16:54:33Z Steverman joined #scheme 2014-09-21T16:54:57Z lrs_: Hmm 2014-09-21T16:58:02Z lrs_: ilammy, http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-10.html#%_sec_1.1.5 I get that stuff. 2014-09-21T16:58:57Z lrs_: Its just when it gets to this point = (succ (plus (pred a) b))))) and where plus is defined as (succ (plus (pred a) b))))) 2014-09-21T16:59:02Z lrs_: I have no idea how to get it 2014-09-21T16:59:18Z lrs_: if plus is = (succ (plus (pred a) b))))) 2014-09-21T16:59:33Z lrs_: How the hell do I put that function in (succ (plus (pred a) b))))) o.o 2014-09-21T16:59:41Z lrs_: What the hell is a and what is b 2014-09-21T17:00:19Z lrs_: Sorry, i meant 2014-09-21T17:00:25Z lrs_: (succ (plus (pred a) b))))) in (plus b (mul (pred a) b)) ) ) ) 2014-09-21T17:01:10Z lrs_: ((+ x 1 (( (succ (plus (pred a) b))))) b (mul (pred a) b)) ) ) )( (- x 1)) b))))) 2014-09-21T17:01:11Z lrs_: o.o 2014-09-21T17:01:45Z lrs_: And it goes into a loop because it calls itself or whatever. I simply just don't get how the functions connect to eachother or maybe I'm just stupid and don't get it. 2014-09-21T17:03:51Z Riastradh quit (Ping timeout: 264 seconds) 2014-09-21T17:07:54Z ilammy: Keep calm, I'm writing an explanation... 2014-09-21T17:13:32Z eupcan277_y joined #scheme 2014-09-21T17:22:14Z gustyhopeful joined #scheme 2014-09-21T17:24:57Z bit` quit (Ping timeout: 272 seconds) 2014-09-21T17:25:13Z ilammy: https://gist.github.com/ilammy/08dac80302492bad3aa5 - if this is not obvious, then i don't know what else to think of.. 2014-09-21T17:27:35Z pjdelport: lrs_: With recursion, it's really just a case of the funtion's body being repeatedly expanded. 2014-09-21T17:28:01Z lrs_: ilammy, Damn, you put in alot of work 2014-09-21T17:28:27Z pjdelport: lrs_: Recursion *can* be infinite, but in Scheme, that's usually a bug. A recursive function will generally have at least two cases: one or more recursive cases, and a "base" case that does not recurse. 2014-09-21T17:28:41Z pjdelport: So the recursion just continues until you hit a base case. 2014-09-21T17:28:49Z yacks joined #scheme 2014-09-21T17:29:01Z pjdelport: You can think of it as working in the same way as mathematical induction. 2014-09-21T17:29:26Z pjdelport: where you always need a base case and an inductive step 2014-09-21T17:30:13Z pjdelport: lrs_: In the case of plus and mul, the 'if' is what makes the recursion terminate. 2014-09-21T17:31:41Z pjdelport: The 'if' condition tells plus to recurse until (= a 0), and then it just returns 'b', instead of recursing further. 2014-09-21T17:32:44Z lrs_: Why is it 2 and 3 after the (plus ..) in line 37 ? 2014-09-21T17:33:04Z lrs_: <pjdelport> You can think of it as working in the same way as mathematical induction. < Yeah, so I have heard 2014-09-21T17:33:15Z lrs_: But I still dont understand mathematical induction to be honest. :| 2014-09-21T17:33:29Z ilammy: These are the arguments to the (lambda ...) form. 2014-09-21T17:33:45Z lrs_: Why are they after the (plus..) line 2014-09-21T17:33:51Z ilammy: The parentheses do matter, the newlines do not. Keep that in mind. 2014-09-21T17:33:54Z lrs_: And why do they disappear 2014-09-21T17:34:07Z lrs_: (plus b (mul (pred a) b)) ) ) 2014-09-21T17:34:07Z lrs_: 2 2014-09-21T17:34:07Z lrs_: 3 2014-09-21T17:35:34Z ilammy: They get substituted as a and b in the body of the lambda form. 2014-09-21T17:36:04Z lrs_: I get that 2014-09-21T17:36:10Z lrs_: But why are they after that line 2014-09-21T17:36:14Z ilammy: Evaluation of expressions like ((lambda ...) arguments ...) is called reduction, or application. 2014-09-21T17:36:17Z lrs_: In that specific place 2014-09-21T17:36:52Z ilammy: Because I had to place them somewhere :) 2014-09-21T17:37:05Z ilammy: I repeat, the newlines do not really matter. 2014-09-21T17:37:05Z lrs_: Ok so its a typo.... (?) 2014-09-21T17:37:18Z lrs_: Line 37-38 2014-09-21T17:37:36Z ilammy: They can be on the same line, this will not change anything (except for readability) 2014-09-21T17:37:48Z pjdelport: lrs_: Remember that if you have a function application form like (f a b), all of 'f', 'a', and 'b' can each be any expression. 2014-09-21T17:38:15Z pjdelport: lrs_: That means you're not just limited to calling *named* functions: 'f' can actually be a lambda expression (which evaluates to a callable function). 2014-09-21T17:38:57Z ilammy: Try to think of expression as trees, not lines. 2014-09-21T17:39:04Z pjdelport: lrs_: So you could say, for example ((lambda (x y) (+ x y) foo bar) 2014-09-21T17:39:22Z lrs_: I get that, no problem 2014-09-21T17:39:29Z lrs_: I get the substitution 2014-09-21T17:39:34Z pjdelport: Err, sorry, paren error: ((lambda (x y) (+ x y)) foo bar) 2014-09-21T17:39:45Z lrs_: But why is the 2 3 at the end of the whole function 0.0 2014-09-21T17:39:51Z pjdelport: That calls the function (lambda (x y) (+ x y)) with parameters foo and bar 2014-09-21T17:40:06Z pjdelport: lrs_: It's exactly the same thing, that's what i'm trying to say. :) 2014-09-21T17:40:30Z pjdelport: lrs_: Note the leading paren. 2014-09-21T17:40:44Z bit` joined #scheme 2014-09-21T17:41:04Z pjdelport: lrs_: The function itself is the whole lambda expression, and there's *another* pair of parens outside of it that calls that function with the parameters 2 and 3. 2014-09-21T17:41:08Z ilammy: Because they are arguments to that function. Arguments go after a function in function call expressions. 2014-09-21T17:41:20Z lrs_: Hmm 2014-09-21T17:41:40Z pjdelport: lrs_: In other words, the whole thing is just: ((lambda (a b) ...) 2 3) 2014-09-21T17:42:02Z pjdelport: where ... is the body of that lambda with the 'if'. 2014-09-21T17:43:01Z lrs_: http://pastebin.com/hUL6bkjq < So this is the first step that happens when you enter (lambda 2 3) 2014-09-21T17:43:01Z lrs_: ? 2014-09-21T17:46:00Z pjdelport: lrs_: Well, when you enter (mul 2 3) yes. 2014-09-21T17:46:06Z lrs_: Why? 2014-09-21T17:46:07Z kongtomorrow joined #scheme 2014-09-21T17:46:28Z pjdelport: lrs_: When Scheme sees (mul 2 3), it will first evaluate each of the three parts of that expression, and then do the application. 2014-09-21T17:46:47Z lrs_: Oh 2014-09-21T17:46:59Z pjdelport: "mul" itself is just an expression: and 'mul' is a variable just like any other. 2014-09-21T17:47:18Z lrs_: I thought the first step was substitution 2014-09-21T17:47:31Z pjdelport: mul's value just happens to be a function 2014-09-21T17:47:54Z pjdelport: So first, Scheme evaluates "mul" and replaces the binding with its value, which is that whole lambda. 2014-09-21T17:48:14Z pjdelport: It evaluates 2 and 3 too, but those just evaluate to themselves, so the say stay the same. 2014-09-21T17:48:29Z pjdelport: And then it performs the call, by substituting 2 and 3 into the body of the lambda. 2014-09-21T17:50:13Z pjdelport: So that's an important point about Scheme: there's no distinction between "function" variable names and "value" variable names: everything is just the same to Scheme. 2014-09-21T17:50:41Z pjdelport: So whether you say (define x 5) or (define mul (lambda ...)), exactly the same thing happens: a name is just being assigned a value. 2014-09-21T17:51:16Z pjdelport: You could actually say (define a 2) and (define b 3), and then say (a b) 2014-09-21T17:51:47Z pjdelport: That's legal syntax, and Scheme will try to evaluate it: it will replace each name with its value to get (2 3) 2014-09-21T17:52:37Z pjdelport: And then it will basically try to call 2 as a function, giving it "3" as parameter, but that of course won't work, and will give you an error instead: something like "2 is not a function". 2014-09-21T17:53:00Z lrs_: Hmmm 2014-09-21T17:53:57Z pjdelport: But the point is that there's no magic at all: whenever Scheme sees (x y z ...), it just evaluates each of the inner expressions (which can be any expression at all), and then treats the first one (x in this case) as a function to call with the remaining values as parameter(s). 2014-09-21T17:54:11Z pjdelport: That's literally all there is to it. 2014-09-21T17:54:34Z logand quit (Remote host closed the connection) 2014-09-21T17:55:07Z pjdelport: (The only exceptions are special forms / macros like "if", for example: they define their own special evaluation rules, which is how you get conditional evaluation and control structures and so on.) 2014-09-21T17:57:38Z lrs_: I dont really understand what you mean when you say "call" 2014-09-21T17:58:31Z BitPuffin quit (Ping timeout: 272 seconds) 2014-09-21T17:59:26Z pjdelport: (But you will learn all about those too.) 2014-09-21T18:01:41Z ilammy: (mul 2 3) - this a 'function call expression'. Evaluating such expression is called 'calling a function'. 2014-09-21T18:02:59Z pjdelport: lrs_: "call" just means to evaluate a function with certain parameters. 2014-09-21T18:03:18Z lrs_: so 2014-09-21T18:03:21Z lrs_: (mul 2 3) 2014-09-21T18:03:22Z lrs_: is 2014-09-21T18:03:23Z aretecode joined #scheme 2014-09-21T18:03:24Z b4283 quit (Quit: Konversation terminated!) 2014-09-21T18:03:37Z lrs_: (function parameter parameter) or is it uh... 2014-09-21T18:03:55Z lrs_: Im not really sure, the fact that the 2 3 is compiled after it as the first step makes it weird 2014-09-21T18:03:58Z pjdelport: In pure mathematics, you might evaluate a function like (cos 0) to the value 1 2014-09-21T18:04:06Z lrs_: Right 2014-09-21T18:06:00Z taylanub: (tidbit: "parameter" is the variable the function binds in its body; "argument" is the value the function receives and binds to that variable.) 2014-09-21T18:06:41Z taylanub: https://en.wikipedia.org/wiki/Parameter_(computer_programming) 2014-09-21T18:07:33Z pjdelport: lrs_: Pretty much, yeah. In general, (func arg1 arg2 ...) 2014-09-21T18:08:06Z pjdelport: lrs_: This may be a silly question, but do you have an interactive Scheme environment that you're working in? 2014-09-21T18:08:20Z pjdelport: It can help a *lot* just to play around with and evaluate things interactively. 2014-09-21T18:08:24Z pjdelport: To get a feel for it. 2014-09-21T18:08:28Z lrs_: Yeah, Im using racket with the "Pretty big" loaded 2014-09-21T18:08:35Z pjdelport: Just type in any expression you're unsure about, and see what it evaluates to. 2014-09-21T18:08:46Z lrs_: But alot of the stuff is on paper so 2014-09-21T18:09:07Z pjdelport: You can load those into a Scheme file, and then load that into your REPL to play around with :) 2014-09-21T18:09:54Z lrs_: Which ones? 2014-09-21T18:10:24Z jlongster joined #scheme 2014-09-21T18:11:01Z lrs_: Also do you have any suggestions on how to improve your scheme skills other than reading the SICP book? Any good tutorials or videos or something 2014-09-21T18:11:32Z asumu: lrs_: BTW if you're doing SICP, you may not want to use the "Pretty big" language (which is pretty deprecated) and instead use http://www.neilvandyke.org/racket-sicp/ 2014-09-21T18:11:38Z lrs_: But very nice work ilammy, even though I dont understand all of what youve written but im gonna keep it and read it until I do 2014-09-21T18:13:27Z pjdelport: lrs_: Personally, i find it helps to just read a whole number of tutorials at once. 2014-09-21T18:13:46Z pjdelport: It might sound confusing, but it isn't that much: they all complement each other. 2014-09-21T18:13:58Z pjdelport: When you get stuck with one, you just switch to another for a while, and find what works for you. 2014-09-21T18:15:16Z lrs_: pjdelport, Yeah thats what I figure too, I think Ill learn this stuff faster just by doing tutorials and having some handy definition book at hand.. This book isnt that great to be honest or maybe im just a person that learns by doing 2014-09-21T18:15:27Z pjdelport: SICP is pretty in-depth. 2014-09-21T18:15:47Z lrs_: What I need to do I guess is to get an idea how it "is" 2014-09-21T18:15:51Z pjdelport: It's much more of a full university course than a quick tutorial. 2014-09-21T18:16:10Z lrs_: Like, Ive basically understood that it all is built on a recursive tree, "shells" and uh, lists 2014-09-21T18:16:30Z lrs_: I still havent understand what lambda is exactly 2014-09-21T18:16:46Z eupcan277_y_h joined #scheme 2014-09-21T18:16:53Z eupcan277_y quit (Ping timeout: 272 seconds) 2014-09-21T18:17:09Z lrs_: asumu, Ive downloaded that one now, so ill check it out 2014-09-21T18:17:40Z jlongster quit (Ping timeout: 260 seconds) 2014-09-21T18:28:35Z pjdelport: lrs_: Have you glanced over http://en.wikipedia.org/wiki/Lambda_calculus briefly just for some basic theory? 2014-09-21T18:29:02Z pjdelport: lambda itself is just a special form that constructs functions, in Scheme. 2014-09-21T18:30:05Z lrs_: pjdelport, Cool, Ive seen the page but I will read it 2014-09-21T18:30:29Z pjdelport: lrs_: You don't have to worry too much about the detail of the theory, but that's where it comes from. 2014-09-21T18:30:51Z pjdelport: lrs_: The basic idea is just: (lambda ) 2014-09-21T18:31:32Z pjdelport: That creates a function value that you can call or apply, and that will accept the given named parameters, and substitute them into the body. 2014-09-21T18:31:35Z lrs_: So define is just, define the function that has the lambda that gives the arguments and body 2014-09-21T18:31:47Z lrs_: But in some cases you dont even need lambda o.o 2014-09-21T18:31:51Z lrs_: But you can use it still 2014-09-21T18:31:54Z lrs_: I have one example 2014-09-21T18:32:05Z lrs_: (define (factorial n) 2014-09-21T18:32:05Z lrs_: (if (= n 1) 2014-09-21T18:32:05Z lrs_: 1 2014-09-21T18:32:05Z lrs_: (* n (factorial (pred n))))) 2014-09-21T18:32:28Z pjdelport: Ah, right. That is actually just a syntactic shortcut that Scheme has. 2014-09-21T18:32:35Z lrs_: There was someone else that did the same but he used lambda 2014-09-21T18:32:48Z lrs_: I dont really see the connection or, the reasoning behind this 2014-09-21T18:33:06Z pjdelport: The basic form of 'define' is always (define ) 2014-09-21T18:33:32Z pjdelport: So the basic way to define a procedure like the above is always: (define factorial (lambda (n) <...>)) 2014-09-21T18:34:16Z pjdelport: However, because it's tedious to keep typing out lambda like that, Scheme lets you also define that using the shortcut: (define (factorial n) <...>) 2014-09-21T18:35:24Z pjdelport: So when you say: (define (f ) ) 2014-09-21T18:35:24Z pjdelport: Scheme will just translate it to: (define f (lambda () ) wrapped in parens, while the second one just has the symbol 'f' bare.) 2014-09-21T18:40:29Z lrs_: So the one wiht lambda just has (define factorial ) 2014-09-21T18:42:32Z pjdelport: Right. 2014-09-21T18:42:53Z pjdelport: In the above examples, everything is literal except for the bits i wrote as <...> with angle brackets, which are placeholders. 2014-09-21T18:44:07Z effy joined #scheme 2014-09-21T18:46:37Z lrs_: Cool 2014-09-21T18:47:35Z civodul joined #scheme 2014-09-21T18:52:24Z suppi_ quit (Quit: Leaving) 2014-09-21T18:52:40Z effy quit (Ping timeout: 260 seconds) 2014-09-21T18:53:47Z dzhus joined #scheme 2014-09-21T19:00:44Z tadni quit (Remote host closed the connection) 2014-09-21T19:01:25Z tadni joined #scheme 2014-09-21T19:04:32Z eupcan277_y_h_h joined #scheme 2014-09-21T19:05:01Z eupcan277_y_h quit (Ping timeout: 272 seconds) 2014-09-21T19:06:48Z klltkr joined #scheme 2014-09-21T19:14:16Z jlongster joined #scheme 2014-09-21T19:16:20Z autochthon quit (Remote host closed the connection) 2014-09-21T19:18:48Z jlongster quit (Ping timeout: 260 seconds) 2014-09-21T19:23:14Z kongtomorrow quit 2014-09-21T19:26:19Z lrs_: Thanks for the help though, see ya 2014-09-21T19:28:39Z klltkr quit (Quit: My MacBook has gone to sleep. ZZZzzz…) 2014-09-21T19:31:24Z lrs_ quit (Ping timeout: 260 seconds) 2014-09-21T19:38:03Z eupcan277_y_h_h_ joined #scheme 2014-09-21T19:38:33Z eupcan277_y_h_h quit (Ping timeout: 244 seconds) 2014-09-21T19:42:47Z bjz quit (Ping timeout: 272 seconds) 2014-09-21T19:45:31Z effy joined #scheme 2014-09-21T19:52:09Z kyubiko joined #scheme 2014-09-21T19:53:02Z kongtomorrow joined #scheme 2014-09-21T19:59:25Z klltkr joined #scheme 2014-09-21T19:59:52Z Steverman quit (Ping timeout: 260 seconds) 2014-09-21T20:05:43Z bjz joined #scheme 2014-09-21T20:07:23Z t0ryzal joined #scheme 2014-09-21T20:12:14Z robot-beethoven joined #scheme 2014-09-21T20:19:27Z kongtomorrow quit 2014-09-21T20:21:44Z civodul quit (Quit: ERC Version 5.3 (IRC client for Emacs)) 2014-09-21T20:22:25Z BitPuffin joined #scheme 2014-09-21T20:24:30Z lrs_ joined #scheme 2014-09-21T20:24:37Z eupcan277_y_h_h_ quit (Ping timeout: 260 seconds) 2014-09-21T20:27:38Z ski quit (Ping timeout: 244 seconds) 2014-09-21T20:28:23Z ski joined #scheme 2014-09-21T20:36:53Z ARM9 quit (Quit: Leaving) 2014-09-21T20:43:31Z tadni quit (Remote host closed the connection) 2014-09-21T20:45:08Z tadni joined #scheme 2014-09-21T20:47:22Z hiyosi quit (Ping timeout: 245 seconds) 2014-09-21T20:51:50Z tadni quit (Ping timeout: 272 seconds) 2014-09-21T20:57:25Z kyubiko quit (Quit: WeeChat 1.0) 2014-09-21T20:59:35Z mrowe_away is now known as mrowe 2014-09-21T21:17:23Z taylanub quit (Disconnected by services) 2014-09-21T21:18:05Z taylanub joined #scheme 2014-09-21T21:18:53Z tadni joined #scheme 2014-09-21T21:20:37Z wingo quit (Ping timeout: 245 seconds) 2014-09-21T21:25:08Z bjz_ joined #scheme 2014-09-21T21:25:09Z tadni quit (Remote host closed the connection) 2014-09-21T21:25:46Z tadni joined #scheme 2014-09-21T21:25:50Z tadni quit (Remote host closed the connection) 2014-09-21T21:26:45Z atomx_ joined #scheme 2014-09-21T21:27:39Z rotty_ joined #scheme 2014-09-21T21:27:47Z micro joined #scheme 2014-09-21T21:28:11Z micro is now known as Guest91815 2014-09-21T21:28:16Z mrowe is now known as mrowe_away 2014-09-21T21:29:02Z ijp quit (Quit: This ijp has ended peacefully) 2014-09-21T21:29:09Z twem2_ joined #scheme 2014-09-21T21:31:10Z Guest56725 quit (Ping timeout: 272 seconds) 2014-09-21T21:31:10Z rotty quit (Ping timeout: 272 seconds) 2014-09-21T21:31:11Z twem2 quit (Ping timeout: 272 seconds) 2014-09-21T21:31:11Z bjz quit (Ping timeout: 272 seconds) 2014-09-21T21:31:14Z oleo quit (Ping timeout: 272 seconds) 2014-09-21T21:31:14Z atomx quit (Ping timeout: 272 seconds) 2014-09-21T21:31:15Z antoszka quit (Ping timeout: 272 seconds) 2014-09-21T21:31:18Z antoszka_ joined #scheme 2014-09-21T21:31:49Z dmiles_afk quit (Ping timeout: 260 seconds) 2014-09-21T21:31:56Z antoszka_ is now known as antoszka 2014-09-21T21:34:32Z oleo joined #scheme 2014-09-21T21:36:11Z kongtomorrow joined #scheme 2014-09-21T21:36:36Z akkad quit (Ping timeout: 272 seconds) 2014-09-21T21:37:46Z akkad joined #scheme 2014-09-21T21:39:10Z Rodya_ joined #scheme 2014-09-21T21:40:31Z hiyosi joined #scheme 2014-09-21T21:40:43Z t0ryzal quit (Quit: Leaving) 2014-09-21T21:45:17Z hiyosi quit (Ping timeout: 245 seconds) 2014-09-21T21:45:26Z kongtomorrow quit 2014-09-21T21:53:38Z c107 joined #scheme 2014-09-21T21:58:04Z c107 quit (Remote host closed the connection) 2014-09-21T21:58:45Z c107 joined #scheme 2014-09-21T22:07:57Z tom39291 joined #scheme 2014-09-21T22:09:23Z lrs_ quit (Ping timeout: 240 seconds) 2014-09-21T22:20:03Z guampa quit (Ping timeout: 264 seconds) 2014-09-21T22:20:05Z weinholt quit (Ping timeout: 272 seconds) 2014-09-21T22:20:12Z weinholt joined #scheme 2014-09-21T22:21:28Z clog quit (Ping timeout: 245 seconds) 2014-09-21T22:21:52Z MouldyOldBones quit (Ping timeout: 264 seconds) 2014-09-21T22:22:18Z haroldwu quit (Ping timeout: 245 seconds) 2014-09-21T22:23:01Z guampa joined #scheme 2014-09-21T22:23:26Z haroldwu joined #scheme 2014-09-21T22:24:22Z arbscht quit (Ping timeout: 245 seconds) 2014-09-21T22:25:36Z MouldyOldBones joined #scheme 2014-09-21T22:30:04Z arbscht joined #scheme 2014-09-21T22:34:06Z clog joined #scheme 2014-09-21T22:41:23Z hiyosi joined #scheme 2014-09-21T22:46:41Z hiyosi quit (Ping timeout: 272 seconds) 2014-09-21T22:52:28Z ilammy quit (Ping timeout: 246 seconds) 2014-09-21T22:54:27Z z0d quit (Ping timeout: 256 seconds) 2014-09-21T22:54:27Z z0d joined #scheme 2014-09-21T22:54:28Z z0d quit (Changing host) 2014-09-21T22:54:28Z z0d joined #scheme 2014-09-21T23:04:44Z Gyps joined #scheme 2014-09-21T23:06:27Z dzhus quit (Ping timeout: 246 seconds) 2014-09-21T23:15:42Z Gyps quit (Ping timeout: 245 seconds) 2014-09-21T23:16:52Z mrowe_away is now known as mrowe 2014-09-21T23:20:42Z bjz_ quit (Ping timeout: 258 seconds) 2014-09-21T23:24:05Z Gyps joined #scheme 2014-09-21T23:32:21Z BitPuffin quit (Ping timeout: 246 seconds) 2014-09-21T23:37:11Z atomx_ quit (Ping timeout: 258 seconds) 2014-09-21T23:41:04Z hiyosi joined #scheme 2014-09-21T23:46:52Z kongtomorrow joined #scheme 2014-09-21T23:59:52Z alexei___ quit (Ping timeout: 240 seconds)