IRC channel logs

2017-07-12.log

back to list of logs

<cmaloney>what?
<amz3>héllo :)
<roelj>Any convenient way to replace all occurrences of a character in a string with another character?
<lloda>(string-map (lambda (c) (if (char=? c a) b c)) s)
<OrangeShark>hello
<OrangeShark>amz3: for guile-git, I am thinking we should just call libgit2-init! in the git module.
<happy_gnu>hi :)
<stis>heya happy_gnu
<happy_gnu>I am trying to create a random number in an interval, but I have no idea how to do it
<happy_gnu>I would like to say (random 4 50)
<happy_gnu>or something like that
<happy_gnu>hi stis :)
<stis> https://www.gnu.org/software/guile/manual/html_node/SRFI_002d27-Default-Random-Source.html#index-random_002dreal
<stis>(define (my-random a b) (let ((d (- b a))) (+ a (* (random-real) d))))
<stis>will get your function
<stis>happy_gnu: ^^
<lloda>(random d) is in (guile). Only problem is that (random 0) is an error :-/
<happy_gnu>stis: perfect :D great thanks :)
<happy_gnu>stis: I have another question :)
<happy_gnu>how can I write a function that set! and calls another function
<happy_gnu>(define smaller
<happy_gnu> ((set! big 8)
<happy_gnu> (guess-number)))
<happy_gnu>I would like smaller to set big to 8 and after that to execute guess-number
<stis>happy_gnu: (define big 1) (define (smaller) (set! big 8) (guess-number)
<stis>you need to define big first
<stis>you can also use lamabda
<stis>(define smaller (lambda () ....))
<stis>you call smaller as (smaller)
<happy_gnu>ohh thanks stis I was lacking the parentheses on (smaller) :)
<stis>there is macrology that allows you to call a function by just issuing the symbol btw, but it's considered bad style
<stis>try (define syntax s (syntax-rules () (_ (smaller))))
<stis>then issue s
<stis>(define-syntax s (lambda (x) (syntax-case x () (_ #'(smaller)))))
<stis>i think works, at least
<avoine>stis: about your parser, in your calculator for example, if I want to transform the result of the parser into scheme I can I do it?
<stis>as in an scheme evaluater or as in scheme code?
<stis>maybe I should make a compiler and an evaluater and make a calc language for you all to try
***sudoman_ is now known as sudoman
<stis>avoine: ^^
<avoine>stis: so I fold on the result and transform it with a pattern match for example?
<avoine>and then use eval on the result
<stis>let me check in my evaluator, hang on a sec
<stis>check out the repository, calc has an evaluator, (e "1 + 1") -> 2
<stis>avoine: yes you can use eval
<avoine>oh that e is what I'm looking for!
<avoine>thanks stis
<stis>update, I added a spec.scm file in language/calc that enables the calculator as a command line feature, obs line based
<stis>it's a good simple example to learn from
<happy_gnu>stis: ohh that is good
<happy_gnu>thanks stis :)
<stis>see README
<stis>Yeah I tested and made an example in calc.scm of the expression parser tool. enjoy (see README)
<happy_gnu>stis: is that a program you wrote? do you have a repository to read the code :) ?
<happy_gnu>maybe I will understand a little :P
<happy_gnu>i've read that to learn programming is important to read a lot of code :)
<happy_gnu>I've been reading a few gimp plugins, but they use a lot let*, and I think simple scheme or SICP say that let* is bad practice :/
<avoine>happy_gnu: you can read the code here: https://gitlab.com/tampe/stis-parser
<happy_gnu>avoine: thanks :)
<happy_gnu>it seems to advanced for me though :P
<amz3`>happy_gnu: why do you think let* is bad pratice?
<happy_gnu>amz3`: I read it or watch in eitheir simple scheme or SICP
<amz3`>maybe it's because let* does some magic that is not required most of the time
<happy_gnu>I don't remember which one though, but I am just starting so maybe it was to start.
<happy_gnu>yeah amz3`, something like that, I think it was on the videolectures of sicp, that they said it is mostly not used by schemers
<rekado>when a simple “let” is enough, there’s no need for “let*”
<happy_gnu>I am not sure, I am reading the 2 books and watching the video lectures of berkeley and mit
<amz3`>happy_gnu: I doing a screencast on guile hacking on youtube
<happy_gnu>so, i tend to get confused
<happy_gnu>ohh amz3` please send me the link :)
<rekado>but when you want to have a binding that refers to a previous binding there really isn’t any other elegant way
<happy_gnu>I try to learn as much as I can
<rekado>you could always nest “let”
<amz3`>+1 rekado
<happy_gnu>there is not the same quantity of learning materials for python or javascript than there is for scheme
<amz3`>sometimes I nest let to document better the code
<happy_gnu>but so far I am loving way more scheme than python or javascript is so much simpler, so understendable
<amz3`>happy_gnu: you mean that there is no one liner solution for left padding a string on stackoverflow in scheme?
<happy_gnu>I know little javascript and little python
<amz3`>happy_gnu: what do you want to hack on?
<amz3`>happy_gnu: any particular project you'd like to realize?
<amz3`>happy_gnu: any particular interest
<happy_gnu>amz3`: for now I am just starting, so I am trying to learn :) maybe a videogame
<amz3`>happy_gnu: you are right, usually stis does advanced stuff I still don't fully grasp
<happy_gnu>I saw guile-2d which now has a different game but, I get a little confused
<happy_gnu>a different "name" sorry
<amz3`>happy_gnu: you can download it using: youtube-dl https://www.youtube.com/playlist?list=PL_jCPpfzyfeqqEcioz71x5XvXnq9UABdK
<happy_gnu>great amz3` :)
<amz3`>the first seven videos are about a full stack scheme web framework
<happy_gnu>i am also reading "the land of lisp" it uses clisp but I am trying to translate it to scheme
<happy_gnu>guile :)
<amz3`>happy_gnu: I don't educate tho
<happy_gnu>ohhh this is good!
<rekado>happy_gnu: there’s also “realm of racket”
<happy_gnu>rekado: yes!! i forget to download it!
<amz3`>I am mean, I don't try to explain everything, but if you have question, don't hesitate to ask here or in the comment section
<amz3`>the second part is about wiredtiger, a database library similar to sqlite
<happy_gnu>amz3`: yes, thanks :) this is too good, I need to learn more and more
<amz3`>happy_gnu: if you have a particular idea, outside making a game for a project I could make a video about it explaining how to do it
<happy_gnu>you have the same wallpaper than I, by the way
<random-nick>happy_gnu: referring to common lisp as "clisp" is ambiguous because there's an implementation of common lisp called GNU CLISP
<amz3`>happy_gnu: :D
<amz3`>happy_gnu: best way to learn is to have pet projects i think
<amz3`>happy_gnu: or try to contribute
<amz3`>happy_gnu: I would be very HAPPY if there was an equivalent of docopt in guile
<amz3`>for instance
<happy_gnu>amz3`: when I see code I tend to feel stupid :/
<amz3`>happy_gnu: no!
<happy_gnu>i don't understand many things
<happy_gnu>and I feel like I need to learn more
<amz3`>happy_gnu: you have a good habit if you read code
<amz3`>happy_gnu: i don't read much code actually
<cmaloney>++
<happy_gnu>you use webgil in the first video right?
<OrangeShark>random-nick: if I recall, land of lisp does in fact use GNU CLISP
<amz3`>but it's a good thing
<cmaloney>was re: the good habit to read code
<amz3`>happy_gnu: webgil?
<happy_gnu>OrangeShark: yes, clisp :)
<cmaloney>Land of Lisp uses Common Lisp. Don't recall if it's specifically GNU CLISP
<amz3`>Land of Lisp is the tutorial with aliens and stuff?
<happy_gnu>yes :)
<happy_gnu>is funny
<random-nick>OrangeShark: then I must've confused it with some other book
<happy_gnu>today I read the first 3 chapters
<random-nick>which had explanations for multiple implementations
<happy_gnu>or 4
<happy_gnu>SICP is really god but there are many math excercises I can't do :/
<cmaloney>Land of Lisp shares the same authors as Realm of Racket
<amz3`>happy_gnu: which programming language do you know?
<cmaloney>minus the student authors
<amz3`>happy_gnu: I got another idea, I wrote a very small editor using Guile, you can read the code, try the editor and do a feature request that I can implement in a video :)
<amz3`>happy_gnu: I am champion toy program developper :)
<amz3`>happy_gnu: https://github.com/amirouche/azul.scm
<rekado>happy_gnu: I haven’t finished SICP; I really enjoyed the video lectures, though.
<amz3`>I did not read SICP too boring for me
<happy_gnu>amz3`: I know a little python and a little javascript
<happy_gnu>but too little
<amz3`>happy_gnu: you don't have a CS background?
<amz3`>if you don't havea computer science background reading SICP or racket book will be helpful
<amz3`>though I started writing webapps before doing all the CS stuff
<happy_gnu>:)
<amz3`>happy_gnu: maybe you can create a game for the terminal?
<amz3`>happy_gnu: what game are you interested in?
<happy_gnu>yeah :) that would be good
<amz3`>RPG kind of game?
<happy_gnu>maybe a chess game :)
<happy_gnu>but that would be too hard :/
<amz3`>no chess game is perfect
<amz3`>actually
<amz3`>I mean it's not too difficult
<happy_gnu>ohh I thougt it was because of the many possibilities
<amz3`>you can create a program for a simpler board game
<cmaloney>Or even something that referees two human players
<amz3`>the rules of Go are much simpler than chess
<cmaloney>not exactly
<cmaloney>Go has capture rules that can get pretty complex
<happy_gnu>ohh that would be better!
<happy_gnu>2 players
<happy_gnu>and no AI
<happy_gnu>to start
<amz3`>I mean that there is less combination of movement
<amz3`>cmaloney: no?
<happy_gnu>what guile library should I use?
<cmaloney>Right, go doesn't have as many special pieces
<amz3`>less "business logic"
<cmaloney>but capturing / scoring can be a PITA
<cmaloney>could make something simple like "capture go"
<amz3`>maybe power of 4 is the easiest
<happy_gnu>I've never played go :/
<cmaloney>happy_gnu: It's a fun game, and much like scheme it starts simple and has a huge rabbit-hole attached to it. :)
<amz3`>yes
<amz3`>until recently no computer could beat a human player
<amz3`>I mean computer could not beat the champion go players
<cmaloney>Right. GNU Go still whips my posterior
<cmaloney>but even GNU Go is pretty weak and formulaic compared with expert Go players
<amz3`>happy_gnu: I recommend you look at https://github.com/amirouche/azul.scm and learn how to use the termbox library then you create a game with termbox and eventually we will port it to graphical library
<amz3`>happy_gnu: I think mastermind is easy to program
<happy_gnu>amz3`: is this for emacs?
<amz3`>happy_gnu: no no, it's a standalone editor
<amz3`>toy editor
<happy_gnu>ohh I understand now :)
<amz3`>it has emacs bindings but that's all, it's not related to emacs, it's more minimal than nano
<amz3`>termbox library is very easy to work with
<happy_gnu>I asked because the .der-locas.el
<amz3`>yeah, that's because I use emacs, that's emacs config file
<amz3`>I am trying to gather some energy, to record a new video
<happy_gnu>amz3`: are the youtube videos about toy editor?
<amz3`>happy_gnu: no, but I could make a video about the toy editor
<amz3`>I am not sure what to explain tho
<happy_gnu>amz3`: which one is the better github or framatig.org ?
<amz3`>honestly I don't know I use both
<amz3`>I think none of them is good :)
<happy_gnu>amz3`: sorry, i meant which one is more up to date :) ?
<amz3`>happy_gnu: I don't understand
<amz3`>framagit and github are different softwares
<happy_gnu>ohh sorry :/
<amz3`>I will record another video about sotogu
<cmaloney>How does one incorporate the termbox module? I'm not seeing how to get started with this
<amz3`>cmaloney: you need to install termbox library from github
<amz3`>cmaloney: the main is in azul.scm
<cmaloney>quick question: is this library for guile 2.2?
<amz3`>cmaloney: yes
<cmaloney>OK, I still have guile 2.0
<cmaloney>so nothing works
<amz3`>I will add a README later
<amz3`>it requires guile-bytestructures from guix
<amz3`>cmaloney: install guix it's easy to install ;)
<cmaloney>unable to locate the ubuntu package for guix. ;:-P
<amz3`>héhé
<amz3`>ArneBab_: do you remember what is the correct shebang to use to execute a given procedure inside a module
<amz3`>ArneBab_: it's documented here actually http://www.draketo.de/proj/py2guile/#sec-2-2-3-2-1
<amz3`>thx!